<template>
  <div class="rrcomBox">
    <div class="comBoxMain" v-for="(item, index) in list" :key="index">
      <div class="rrBoxLeft">{{ item.aut_name }}:</div>
      <div
        class="rrBoxRight van-multi-ellipsis--l2"
        v-html="item.content"
      ></div>
    </div>
  </div>
</template>

<script>
import { apiGetCommentReply } from '../../api/comment'
export default {
  name: 'rrcomBox',
  data () {
    return {
      list: []
    }
  },
  mounted () {
    // const res = await apiGetCommentReply({
    //   commid: this.item.com_id.toString(),
    //   offset: null,
    //   limit: 10
    // })
    // console.log('回复评论列表', res)
    // if (res.data.data.total_count > 3) {
    //   this.list = res.data.data.results.splice(0, 3)
    // } else {
    //   this.list = res.data.data.results
    // }
    this.refresh()
  },
  props: ['item'],
  methods: {
    async refresh () {
      //   console.log('调用')
      const res = await apiGetCommentReply({
        commid: this.item.com_id.toString(),
        offset: null,
        limit: 10
      })
      console.log('回复评论列表', res)
      if (res.data.data.total_count > 3) {
        this.list = res.data.data.results.splice(0, 3)
      } else {
        this.list = res.data.data.results
      }
    }
  }
}
</script>

<style lang="less" scoped>
.rrcomBox {
  width: 375;
  background-color: rgba(224, 224, 224, 0.363);
  margin: 8px;
  margin-left: 55px;
  padding: 5px 10px;
  border: 1px solid rgba(149, 149, 149, 0.5);
  font-size: 12px;
  .comBoxMain {
    display: flex;
    .rrBoxLeft {
      margin-right: 5px;
      white-space: nowrap;
    }
    .rrBoxRight {
      width: 100%;
      word-break: break-all;
    }
  }
}
</style>
